package com.xiao.student.service;

import com.xiao.student.bean.Fangtan;
import com.xiao.student.bean.Renyuan;
import com.xiao.student.bean.User;
import com.xiao.student.mapper.RenyuanMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

/**
 * Created by hz on 2017/1/24.
 */
@Service("ryservice")
public class RenyuanService {
    @Autowired
    private RenyuanMapper mapper;


    /**
     * 登录验证
     * @param user
     * @return
     */
    public User get(User user){
        User rs = mapper.getuser(user);
        return rs;
    }


    /**
     * 添加人员
     * @param renyuan
     * @return
     */
    public boolean save(Renyuan renyuan){
        int rs=mapper.save(renyuan);
        return rs>0;
    }
    /**
     * 根据ID获取人员
     */
    public Renyuan getr(int id){
        Renyuan rs=mapper.getr(id);
        return rs;
    }
    /**
     * 根据手机号获取人员
     */
    public Renyuan getbysjh(String sjh){
        Renyuan rs=mapper.getbysjh(sjh);
        return rs;
    }

    /**
     * 取得不同角色的人员
     * @param juese
     * @return
     */
    public List<Renyuan> get(String juese){
        return  mapper.get(juese);
    }


    /**
     * 更新人员信息
     * @param renyuan
     * @return
     */
    public boolean xinxi(Renyuan renyuan){
        int rs = mapper.xinxi(renyuan);
        return rs>0;
    }
    /**
     * 学生更新学员
     * @param id
     * @return
     */
    public boolean update(String id){
        int rs = mapper.update(id);
        return rs>0;
    }


    /**
     * 得到访谈列表
     * @param id
     * @return
     */
    public List<Fangtan> getft(String id){
        return  mapper.getft(id);
    }
}
